package com.gusha.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name="sys_ticket")
@NamedQuery(name="SysTicket.findAll", query="SELECT s FROM SysTicket s")
@DynamicInsert
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SysTicket implements Serializable{
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private BigInteger id;//id
	
	@Column(name="ticket_no")
	private String ticketNo;//票编号
	
	@ManyToOne(fetch=FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="user_id")
	private User userId;//用户id
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="add_time")
	private Date addTime;//添加时间
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="buy_time")
	private Date buyTime;//购票时间
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="use_time")
	private Date useTime;//使用时间
	
	@Column(name="ticket_state")
	private BigInteger ticketState;//状态  0未支付 1支付 2已使用 3过期 4退票
	
	@Column(name="admin_name")
	private String adminName;//添加人
	
	@ManyToOne(fetch=FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="ticket_category")
	private SysTicketType ticketType;//类型
	
	@Column(name="user_grade")
	private BigInteger userGrade;//用户等级
	
	@Column(name="discount")
	private BigDecimal discount;//折扣
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="effective_time")
	private Date effectiveTime;//退票时间
	
	
	@Column(name="expiration_date")
	private String expirationDate;//截止日期
	
	@Column(name="price")
	private BigDecimal price;
	

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public BigInteger getId() {
		return id;
	}

	public void setId(BigInteger id) {
		this.id = id;
	}

	public String getTicketNo() {
		return ticketNo;
	}

	public void setTicketNo(String ticketNo) {
		this.ticketNo = ticketNo;
	}

	public User getUserId() {
		return userId;
	}

	public void setUserId(User userId) {
		this.userId = userId;
	}

	public Date getAddTime() {
		return addTime;
	}

	public void setAddTime(Date addTime) {
		this.addTime = addTime;
	}

	public Date getBuyTime() {
		return buyTime;
	}

	public void setBuyTime(Date buyTime) {
		this.buyTime = buyTime;
	}

	public Date getUseTime() {
		return useTime;
	}

	public void setUseTime(Date useTime) {
		this.useTime = useTime;
	}

	public BigInteger getTicketState() {
		return ticketState;
	}

	public void setTicketState(BigInteger ticketState) {
		this.ticketState = ticketState;
	}

	public String getAdminName() {
		return adminName;
	}

	public void setAdminName(String adminName) {
		this.adminName = adminName;
	}

	public SysTicketType getTicketType() {
		return ticketType;
	}

	public void setTicketType(SysTicketType ticketType) {
		this.ticketType = ticketType;
	}

	public BigInteger getUserGrade() {
		return userGrade;
	}

	public void setUserGrade(BigInteger userGrade) {
		this.userGrade = userGrade;
	}

	public BigDecimal getDiscount() {
		return discount;
	}

	public void setDiscount(BigDecimal discount) {
		this.discount = discount;
	}

	public Date getEffectiveTime() {
		return effectiveTime;
	}

	public void setEffectiveTime(Date effectiveTime) {
		this.effectiveTime = effectiveTime;
	}

	public String getExpirationDate() {
		return expirationDate;
	}

	public void setExpirationDate(String expirationDate) {
		this.expirationDate = expirationDate;
	}
	
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
}
